<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>宠物管理</title>
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/petManage.css">
    <style>
        /* 左侧标签栏选中 */
        .nav-left .nav-left-item.petProductManage {
            background: #999;
            color: #fcf9f9;
        }

        .w .pet-screen .select-item {
            padding-left: 100px;
        }

        .w .pet-add .pet-add-input, .w .pet-edit .pet-edit-input {
            width: 600px;
            display: flex;
            flex-wrap: wrap;
            margin-left: 65px;
        }

        .w .pet-add .pet-add-item, .w .pet-edit .pet-edit-item {
            display: flex;
            flex-wrap: nowrap;
            justify-content: right;
            align-items: center;
            margin-right: 0;
        }

        .w .pet-add .pet-add-buttons , .w .pet-edit .pet-edit-buttons {
            bottom: 90px;
            margin-right: 90px;
        }


    </style>
</head>

<th:block th:include="~{IncludePage}"></th:block>
<div class="pet-screen">
    <div class="select-item">
        <label class="select-label">种类</label>
        <select name="" class="select-comboBox category" id="category-comboBox">
            <option value="null" selected>————</option>
            <option th:each="category:${categories}" th:value="${category.categoryId}"
                    th:text="${category.name}"></option>
        </select>
    </div>

    <div class="screen-btns">
        <button class="btn screen-btn blue" id="btn-select">筛选</button>
        <button class="btn screen-btn gray" id="btn-reset">重置</button>
        <button class="btn screen-btn gray" id="btn-new">新增</button>
    </div>

    <div class="pet-search">
        <input type="text" class="search-input" id="search-input" placeholder="请输入宠物名">
        <button class="btn search-btn" id="search-btn">搜索</button>
    </div>
</div>
<div class="search-auto-complete" id="auto-complete">
    <ul class="auto-complete-list" id="auto-complete-list">

    </ul>
</div>

<form action="addProduct" class="pet-add" id="add-form">
    <div class="pet-add-input">
        <div class="pet-add-item">
            <label class="add-item-label">品种编号</label>
            <input type="text" class="add-item-input" id="add-productid" placeholder="请输入品种编号" name="productId">
        </div>
        <div class="pet-add-item">
            <label class="add-item-label">种类编号</label>
            <input type="text" class="add-item-input" id="add-categoryid" placeholder="请输入种类编号" name="categoryId">
        </div>
        <div class="pet-add-item">
            <label class="add-item-label">名称</label>
            <input type="text" class="add-item-input" id="add-name" placeholder="请输入名称" name="name">
        </div>
        <div class="pet-add-item">
            <label class="add-item-label">描述</label>
            <input type="text" class="add-item-input" id="add-imgSrc" placeholder="请输入图片地址" name="description">
        </div>
    </div>
    <div class="pet-add-buttons">
        <button class="btn add-pet-btn gray" id="confirm-addProduct-btn">确认添加</button>
        <button class="btn add-pet-btn gray" id="close-form-btn" type="button">关闭</button>
    </div>
</form>

<form action="editProduct" class="pet-edit" id="edit-form">
    <div class="pet-edit-input">
        <div class="pet-edit-item">
            <label class="edit-item-label">品种编号</label>
            <input type="text" class="edit-item-input" id="edit-productId" placeholder="请输入品种编号" name="productId">
        </div>
        <div class="pet-edit-item">
            <label class="edit-item-label">种类编号</label>
            <input type="text" class="edit-item-input" id="edit-categoryId" placeholder="请输入种类编号" name="categoryId">
        </div>
        <div class="pet-edit-item">
            <label class="edit-item-label">名称</label>
            <input type="text" class="edit-item-input" id="edit-name" placeholder="请输入名称" name="name">
        </div>
        <div class="pet-edit-item">
            <label class="edit-item-label">描述</label>
            <input type="text" class="edit-item-input" id="edit-descn" placeholder="请输入图片地址" name="description">
        </div>
    </div>
    <div class="pet-edit-buttons">
        <button class="btn edit-pet-btn gray" id="confirm-edit-btn" type="submit">确认编辑</button>
        <button class="btn edit-pet-btn gray" id="close-edit-form-btn" type="button">关闭</button>
    </div>
</form>

<div class="pet-table">
    <table class="table" id="pet-table">
        <tr class="table-title">
            <th class="col1">品种编号</th>
            <th class="col2">种类编号</th>
            <th class="col3">名称</th>
            <th class="col4">描述</th>
            <th class="col5">操作</th>
        </tr>

        <tr th:each="product:${products}" id="pet-row">
            <td th:text="${product.productId}" th:id="tableProductId"></td>
            <td th:text="${product.categoryId}"></td>
            <td th:text="${product.name}" id="tableProductName"></td>
            <td th:utext="${product.description}" id="tableProductImg"></td>
            <td class="btns-action">
                <button class="action-btn" id="edit-product-btn">编辑</button>
                <button class="action-btn" id="delete-product-btn">删除</button>
            </td>
        </tr>
    </table>

    <div class="nav-bottom">
        <p class="total">共1条 1页</p>
        <div class="link">上一页</div>
        <p class="current-page">第1页</p>
        <div class="link">下一页</div>
    </div>
</div>

</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="js/petManage.js"></script>
<script src="js/petManage-product.js"></script>
<script src="js/includePage.js"></script>
</html>